package com.lizhen.core.datastructure;

import java.util.EmptyStackException;
import java.util.Stack;

public class StackDataStructure {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();

        System.out.println("init stack: " + stack);

        stack.push(new Integer(42));
        stack.push(new Integer(66));
        stack.push(new Integer(99));

        System.out.println("fill stack: " + stack);

        stack.pop();

        System.out.println("fill stack: " + stack);

        stack.pop();
        stack.pop();
        try {
            stack.pop();
        } catch (EmptyStackException e) {
            System.out.println("empty stack");
        }
    }
}
